package com.mf.pte.techique;

import com.mf.pte.pojo.Item;
import com.mf.pte.utils.StringUtil;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@NoArgsConstructor
public class ProcedureStep {
    private String stepPurpose;

    private List<Item> materialNeededInThisStep;

    public void print(int level ){
        System.out.println(StringUtil.getXTable(level).append(stepPurpose));
        for (Item item : materialNeededInThisStep) {
            item.print(level+1);
        }
    }

    public ProcedureStep(String stepPurpose) {
        this.stepPurpose = stepPurpose;
        this.materialNeededInThisStep = new ArrayList<>();
    }

    public ProcedureStep(String stepPurpose, List<Item> materialNeededInThisStep) {
        this.stepPurpose = stepPurpose;
        this.materialNeededInThisStep = materialNeededInThisStep;
    }

    public void addItemInThisStep(Item item){
        materialNeededInThisStep.add(item);
    }

    public void addItemsInThisStep (List<Item> items){
        materialNeededInThisStep.addAll(items);
    }


}
